package com.aspose.cells;

class zvj {
   static byte[] a(GradientStopCollection var0) {
      Workbook var1 = var0.a().e;
      byte[] var2 = new byte[var0.getCount() * 8 + 6];
      System.arraycopy(com.aspose.cells.b.a.zc.a(var0.getCount()), 0, var2, 0, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var0.getCount()), 0, var2, 2, 2);
      var2[4] = 8;
      int var3 = 6;

      for(int var4 = 0; var4 < var0.getCount(); ++var4) {
         GradientStop var5 = var0.get(var4);
         Color var6 = var5.a.b(var1);
         var2[var3] = com.aspose.cells.a.c.zh.b(var6);
         var2[var3 + 1] = com.aspose.cells.a.c.zh.c(var6);
         var2[var3 + 2] = com.aspose.cells.a.c.zh.d(var6);
         int var7 = (int)(var5.getPosition() / 100.0D);
         System.arraycopy(com.aspose.cells.b.a.zc.a((int)((var5.getPosition() / 100.0D - (double)var7) * 65536.0D)), 0, var2, var3 + 4, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var7), 0, var2, var3 + 6, 2);
         var3 += 8;
      }

      return var2;
   }

   static GradientStopCollection a(GradientStopCollection var0, byte[] var1, boolean var2) {
      int var3 = com.aspose.cells.b.a.zc.e(var1, 0) & '\uffff';
      int var4 = com.aspose.cells.b.a.zc.e(var1, 4) & '\uffff';
      if (var4 != 8 && var3 * var4 != var1.length - 6) {
         return null;
      } else {
         int var5 = 6;

         for(int var6 = 0; var6 < var3; ++var6) {
            GradientStop var7 = new GradientStop(var0);
            var7.a.a(2, ((var1[var5] & 255) << 16) + ((var1[var5 + 1] & 255) << 8) + (var1[var5 + 2] & 255));
            var5 += 4;
            var7.setPosition((double)(((float)(com.aspose.cells.b.a.zc.e(var1, var5) & '\uffff') / 65536.0F + (float)(var1[var5 + 2] & 255)) * 100.0F));
            var5 += 4;
            if (var2) {
               var7.setPosition(100.0D - var7.getPosition());
               var0.a(0, var7);
            } else {
               var0.a(var7);
            }
         }

         return var0;
      }
   }

   static GradientStopCollection a(GradientFill var0, int var1, boolean var2, boolean var3) {
      byte[] var4 = MsoFillFormatHelper.c(var1);
      return a(var0, var4, var2, var3);
   }

   static GradientStopCollection a(GradientFill var0, byte[] var1, boolean var2, boolean var3) {
      int var4 = com.aspose.cells.b.a.zc.e(var1, 0) & '\uffff';
      int var5 = com.aspose.cells.b.a.zc.e(var1, 4) & '\uffff';
      if (var5 != 8 && var4 * var5 != var1.length - 6) {
         return null;
      } else {
         int var6 = 6;
         GradientStopCollection var7 = new GradientStopCollection(var0);

         int var8;
         GradientStop var9;
         for(var8 = 0; var8 < var4; ++var8) {
            var9 = new GradientStop(var7);
            var9.a.a(2, ((var1[var6] & 255) << 16) + ((var1[var6 + 1] & 255) << 8) + (var1[var6 + 2] & 255));
            var6 += 4;
            var9.setPosition((double)(((float)(com.aspose.cells.b.a.zc.e(var1, var6) & '\uffff') / 65536.0F + (float)(var1[var6 + 2] & 255)) * 100.0F));
            var6 += 4;
            if (var2) {
               var9.setPosition(100.0D - var9.getPosition());
               var7.a(0, var9);
            } else {
               var7.a(var9);
            }
         }

         if (var3) {
            for(var8 = 0; var8 < var4; ++var8) {
               var9 = var7.get(var8);
               var9.setPosition(var9.getPosition() / 2.0D);
               if (100.0D - var9.getPosition() != var9.getPosition()) {
                  GradientStop var10 = new GradientStop(var7);
                  var10.setPosition(100.0D - var9.getPosition());
                  var10.a.f(var9.a);
                  var7.a(var4, var10);
               }
            }
         }

         return var7;
      }
   }

   static byte[] a(int var0) {
      switch(var0) {
      case 0:
         return MsoFillFormatHelper.az();
      case 1:
         return MsoFillFormatHelper.aC();
      case 2:
         return MsoFillFormatHelper.ax();
      case 3:
         return MsoFillFormatHelper.aE();
      case 4:
         return MsoFillFormatHelper.aL();
      case 5:
         return MsoFillFormatHelper.aF();
      case 6:
         return MsoFillFormatHelper.aJ();
      case 7:
         return MsoFillFormatHelper.ay();
      case 8:
         return MsoFillFormatHelper.av();
      case 9:
         return MsoFillFormatHelper.aO();
      case 10:
         return MsoFillFormatHelper.ar();
      case 11:
         return MsoFillFormatHelper.aN();
      case 12:
         return MsoFillFormatHelper.aI();
      case 13:
         return MsoFillFormatHelper.aD();
      case 14:
         return MsoFillFormatHelper.at();
      case 15:
         return MsoFillFormatHelper.aA();
      case 16:
         return MsoFillFormatHelper.aB();
      case 17:
         return MsoFillFormatHelper.as();
      case 18:
         return MsoFillFormatHelper.aK();
      case 19:
         return MsoFillFormatHelper.au();
      case 20:
         return MsoFillFormatHelper.aM();
      case 21:
         return MsoFillFormatHelper.aH();
      case 22:
         return MsoFillFormatHelper.aw();
      case 23:
         return MsoFillFormatHelper.aG();
      default:
         return null;
      }
   }
}
